/*
 * @Descripttion: ice
 * @version: 1.0.0
 * @Author: ice
 * @Date: 2025-01-13 17:09:20
 * @LastEditors: ice
 * @LastEditTime: 2025-01-15 14:57:28
 */
import request from '@/utils/request'

// 查询订单列表
export function listOrders(query) {
  const { userId, ...otherParams } = query;
  if (userId) {
    return request({
      url: `/orders/orders/listByUserId/${userId}`,
      method: 'get',
      params: otherParams
    });
  } else {
    return request({
      url: '/orders/orders/list',
      method: 'get',
      params: query
    });
  }//sd
}

// 查询订单详细
export function getOrders(id) {
  return request({
    url: '/orders/orders/' + id,
    method: 'get'
  })
}

// 新增订单
export function addOrders(data) {
  return request({
    url: '/orders/orders',
    method: 'post',
    data: data
  })
}

// 修改订单
export function updateOrders(data) {
  return request({
    url: '/orders/orders',
    method: 'put',
    data: data
  })
}

// 删除订单
export function delOrders(id) {
  return request({
    url: '/orders/orders/' + id,
    method: 'delete'
  })
}
